package org.example.controller;


import org.example.entity.Order;
import org.example.entity.User;
import org.example.service.TransService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private TransService transService;


    @RequestMapping("/transition")
    public String transition() {
        User user = new User();
        user.setName("John");
        user.setAge(25);

        Order order = new Order();
        order.setUserId("1");
        order.setItemId(1);
        order.setItemNum(100);

        transService.transition();
        return "ok";
    }
}
